#include <gtest/gtest.h>
#include "scheduler/inverter_scheduler.h"
#include "scheduler/if_then_else_scheduler.h"
#include "scheduler/fallback_scheduler.h"
#include "scheduler/sequence_scheduler.h"
#include "scheduler/scheduler_factory.h"
#include "task/task_factory.h"
#include "../sample/battery_level_check.h"
#include "../sample/navigation_task.h"
#include "../sample/switch_high_current.h"

using namespace scheduler;
using namespace task;

TEST(test_inverter_scheduler, test_inverter_scheduler_set_scheduler)
{
    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
    auto navigation = task::TaskFactory<NavigationTask>::createTask("navigation");

    auto inverter_scheduler = SchedulerFactory<InverterScheduler>::createScheduler("inverter_scheduler");
    inverter_scheduler->setTask(battery_level_check);

    auto sequence_scheduler = SchedulerFactory<SequenceScheduler>::createScheduler("sequence_scheduler");
    sequence_scheduler->appendScheduler(inverter_scheduler);
    sequence_scheduler->appendTask(navigation);

    sequence_scheduler->run();

    EASE_INFO("done");
}

TEST(test_inverter_scheduler, test_inverter_scheduler)
{
//    auto switch_high_current = TaskFactory<SwitchHighCurrent>::createTask("switch_high_current");
//    auto battery_check = TaskFactory<SwitchHighCurrent>::createTask("battery_check");
//    auto screen_return_zero_check = TaskFactory<SwitchHighCurrent>::createTask("screen_return_zero_check");
//
//    auto root_sequence = SchedulerFactory<SequenceScheduler>::createScheduler("root_sequence");
//    auto sequence_scheduler = SchedulerFactory<SequenceScheduler>::createScheduler("sequence_scheduler");
//    auto if_expression_scheduler = SchedulerFactory<IfThenElseScheduler>::createScheduler("if_expression_scheduler");
//    auto or_sequence_policy = SchedulerFactory<IfThenElseScheduler>::createScheduler("or_sequence_policy");
//
//    auto battery_level_check = task::TaskFactory<BatteryLevelCheck>::createTask("battery_level_check");
//    auto navigation = task::TaskFactory<NavigationTask>::createTask("navigation");
//
//    auto inverter_scheduler = SchedulerFactory<InverterScheduler>::createScheduler("inverter_scheduler");
//    inverter_scheduler->setTask(battery_level_check);
//
//    auto sequence_scheduler = SchedulerFactory<SequenceScheduler>::createScheduler("sequence_scheduler");
//    sequence_scheduler->appendScheduler(inverter_scheduler);
//    sequence_scheduler->appendTask(navigation);
//
//    sequence_scheduler->run();

    EASE_INFO("done");
}
